<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <c:set var="ctx" value="${pageContext.request.contextPath}"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>客户C卡V2结果</title>
    <jsp:include page="../../import.jsp" flush="true"/>
    <input type="hidden" value="${cstId}" name="cstId" id="cstId"/>
</head>
<script type="text/javascript">
    var grid = null;
    $(function () {
        var url = '<%=path%>/riskctrl/ccardv2/searchCcardCstListPage.do?cstId=${cstId}';

        $.ajax({
            type: "get",
            url: url,
            dataType: "json",
            contentType: 'application/json;charset=utf-8',
            success: function(data){
                if(data == null){
                    alert("数据异常！")
                }
                console.log(data);
                var finalRiskLevel = data.finalRiskLevel;
                if(finalRiskLevel=="A"){
                    finalRiskLevel="高";
                }else if(finalRiskLevel=="B"){
                    finalRiskLevel="中";
                }else if(finalRiskLevel=="C"){
                    finalRiskLevel="低";
                }else{
                    finalRiskLevel="";
                }
                $("#finalRiskLevel").html(finalRiskLevel);
                $("#result").html(data.result);
                $("#riskDesc").html(data.riskDesc);
                $("#collectStrategy").html(data.collectStrategy);
            },
            error: function (data) {
                console.log('ajax error handling',data);
            }
        })
        grid = liger.get("ligergrid1");


        /*var _url = '<%=path%>/riskctrl/ccardv2/searchCcardCstListPage.do?cstId=${cstId}';
        $("#ligergrid1").ligerGrid({
            url:_url,
            method: 'get',
            columns: [
                {display: '最终⻛险等级', name: 'finalRiskLevel', align: 'center', width: 120,
                        render: function (rowdata, rowindex, value, column) {
                    var result="";
                    if(StringUtils.isEmpty(value)){
                            value = "";
                        }
                        if(value=="A"){
                            result="高";
                        }else if(value=="B"){
                            result="中";
                        }else if(value=="C"){
                            result="低";
                        }else{
                            result="";
                        }
                        return result;
                    }},
                {display: '模型结果', name: 'result', align: 'center', width: 80,render: function (rowdata, rowindex, value, column) {

                        return value;
                    }},
                {display: '⾼⻛险内容展示', name: 'riskDesc', align: 'center',
                    render: function (rowdata, rowindex, value, column) {
                        return value;
                    }},
                {display: '催收策略', name: 'collectStrategy', align: 'center',width: 160,render: function (rowdata, rowindex, value, column) {
                        return value;
                    }},
            ],

            //pageSize: 10,
            /!*root: 'rows',
            record: 'total',*!/
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,
            frozen: false,
            allowUnSelectRow: true,
            alternatingRow: false,
            fixedCellHeight: false,

        });
        grid = liger.get("ligergrid1");
        grid.setHeight(300);*/
    });

    function detail(cstId,batchNo) {
        var vector=  $.ligerDialog.SQopen({
            cls: 'noBorder_Dialog',
            width: 1000,
            height: 500,
            method: 'get',
            title: '项目信息',
            url: '<%=path%>/riskctrl/ccardv2/toCcardV2PrjInfoPage.do?cstId='+cstId+'&batchNo='+batchNo,
            // 自定义buttons的时候 不要设置 fixButtons: true
            buttons: [ {
                text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
                onclick: function (item, Dialog) {
                    //在子页面里绑定 frameElement.dialog.onCancel = function () {}
                    if (Dialog.onCancel) Dialog.onCancel();
                }
            }
            ]
        });
    }

    // 命中规则
    function riskDetail(dataId) {
        // 打开新的页签
        Add_navTab("toTripartitePage"+dataId, "命中规则", '<%=path%>/riskctrl/ccardv2/toCcardV2RiskInfoPage.do?dataId='+dataId);
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }
</script>
<body class="iframeBody">
<div id="ligergrid1" class="sq-grid" style="margin-top:20px;">
    <div style="text-align:center; font-size:22px; margin-top: 20px;">
        <p style="font-weight: bold;background-color: #15b26d;padding-bottom: 20px;padding-top: 20px;color: white">最终⻛险等级</p>
        <div id="finalRiskLevel" style="text-align:center; font-size:18px;line-height: 50px;"></div>
    </div>
    <div style="text-align:center; font-size:22px; ">
        <p style="font-weight: bold;background-color: #15b26d;padding-bottom: 20px;padding-top: 20px;color: white">模型结果</p>
        <div id="result" style="text-align:center; font-size:18px;line-height: 50px;"></div>
    </div>
    <div style="text-align:center; font-size:22px; ">
        <p style="font-weight: bold;background-color: #15b26d;padding-bottom: 20px;padding-top: 20px;color: white">⾼⻛险内容展示</p>
        <div id="riskDesc" style="text-align:center; font-size:18px;line-height: 50px;"></div>
    </div>
    <div style="text-align:center; font-size:22px; ">
        <p style="font-weight: bold;background-color: #15b26d;padding-bottom: 20px;padding-top: 20px;color: white">催收策略</p>
        <div id="collectStrategy" style="text-align:center; font-size:18px;line-height: 50px;"></div>
    </div>



</div>
</body>
</html>